package com.demo.controller;

import com.demo.pojo.Dept;
import com.demo.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @author chenyuan
 * @date 2020/9/29 10:22
 */
@RestController
public class DeptConsumerController2 {
    @Autowired
    private DeptClientService service = null;

    @RequestMapping("/consumer/getDeptById/{id}")
    public Dept getDeptById(@PathVariable("id")Long id){
        return this.service.queryDeptById(id);
    }

    @RequestMapping("/consumer/getDepts")
    public List<Dept> getDepts(){
        return this.service.queryDepts();
    }

    @RequestMapping("/consumer/addDept")
    public Boolean addDept(Dept dept){
        return this.service.addDept(dept);
    }
}
